package com.zw.transition.services;

import com.zw.transition.entity.User;
import com.zw.transition.mapper.UserMapper;
import org.apache.shiro.crypto.hash.SimpleHash;
import org.apache.shiro.util.ByteSource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Description:
 *
 * @Author: China.sgl
 * @Date: 2019/9/16 09:11
 */
@Service
@SuppressWarnings("all")
public class UserService {

    @Autowired
    private UserMapper userMapper;
    @Autowired
    private LogService logService;

    public User login(User user) {
        user.setPwd(new SimpleHash("MD5", user.getPwd(), ByteSource.Util.bytes(user.getAccount()), 8).toString());
        user.setStatus(1);
        return userMapper.findByAccountAndPasswordAndStatus(user);
    }
}
